package com.itheima.domain;

import java.util.Random;

/**
 *实现Student类
 */
public class StudentTest {
    public static void main(String[] args) {
        //创建对象
        Student s1= new Student("张三",28,new Random().nextInt(101));
        Student s2= new Student("李四",18,new Random().nextInt(101));
        Student s3= new Student("彭于晏",38,new Random().nextInt(101));
        Student s4= new Student("王梅",58,new Random().nextInt(101));
        Student s5= new Student("满一航",38,new Random().nextInt(101));
        //创建合适的容器,选择数组,数据类型是Student, 长度为4
        Student []arr= new Student[5];
        //存储数据
        arr[0]=s1;
        arr[1]=s2;
        arr[2]=s3;
        arr[3]=s4;
        arr[4]=s5;
        //遍历数组
        for (int i = 0; i < arr.length; i++) {
            //获取当前Student对象
            Student stu= arr[i];
            //判断他的分数
            if (stu.getScore()<60){
                stu.show();
                System.out.println(stu);
            }
        }
    }

}
